package com.lst.api.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lst.api.vo.LoanInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import com.lst.tools.mybatis.entity.DeleteBaseModel;

/**
 * 贷款信息表
 *
 * @author Frank
 * @date 2019-12-30 10:31:37
 * @version: V1.0
 */
@Data
@NoArgsConstructor
@TableName(value = "lst_loan_info")
@ApiModel(value = "贷款信息表")
public class LoanInfo extends DeleteBaseModel {

    public static final String APPLY_NO = "apply_no";
    public static final String PROMO_USER_ID = "promo_user_id";
    public static final String LOAN_BANK_ID = "loan_bank_id";
    public static final String LOAN_AMOUNT = "loan_amount";
    public static final String SURPLUS_AMOUNT = "surplus_amount";
    public static final String OVERDUE_ID = "overdue_id";

    @ApiModelProperty(name = "applyNo", value = "申请编号", dataType = "String")
    @TableField(value = APPLY_NO)
    private String applyNo;

    @ApiModelProperty(name = "promoUserId", value = "推销员用户id", dataType = "Long")
    @TableField(value = PROMO_USER_ID)
    private Long promoUserId;

    @ApiModelProperty(name = "loanBankId", value = "贷款银行id", dataType = "Long")
    @TableField(value = LOAN_BANK_ID)
    private Long loanBankId;

    @ApiModelProperty(name = "loanAmount", value = "贷款金额，单位元", dataType = "Double")
    @TableField(value = LOAN_AMOUNT)
    private Double loanAmount;

    @ApiModelProperty(name = "surplusAmount", value = "剩余本金", dataType = "Double")
    @TableField(value = SURPLUS_AMOUNT)
    private Double surplusAmount;

    @ApiModelProperty(name = "overdueId", value = "逾期情况id", dataType = "Long")
    @TableField(value = OVERDUE_ID)
    private Long overdueId;

    public LoanInfo(long userId, String applyNo, LoanInfoVo loanInfoVo) {
        this.applyNo = applyNo;
        this.promoUserId = userId;
        this.loanBankId = loanInfoVo.getLoanBankId();
        this.loanAmount = loanInfoVo.getLoanAmount();
        this.surplusAmount = loanInfoVo.getSurplusAmount();
        this.overdueId = loanInfoVo.getOverdueId();
    }
}